//
//  main.m
//  sort
//
//  Created by Bc_Ltf on 15/2/6.
//  Copyright (c) 2015年 Bc_Ltf. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "pinyin.h"

int main(int argc, const char * argv[]) {
    @autoreleasepool {

        //  数组英文begin
        NSMutableArray *dataArray=[NSMutableArray array];
        [dataArray addObjectsFromArray:@[@"d",@"c",@"b",@"a",]];
        NSLog(@"origin");
        for (NSString *string in dataArray) {
            NSLog(@"%@",string);
        }
        
        // 第一次排序
        NSArray *sortEnglish=[dataArray sortedArrayUsingSelector:@selector(compare:)];
        NSLog(@"first");
        for (NSString *string in sortEnglish) {
            NSLog(@"%@",string);
        }
        
        // 给数组加上中文
        [dataArray removeAllObjects];
        [dataArray addObjectsFromArray:@[@"张",@"王",@"李",@"赵",]];
        NSLog(@"chinese");
        for(NSString *string in dataArray)
        {
            NSLog(@"%@",string);
        }
        
        NSLog(@"字的Unicode码是 %d",[@"字" characterAtIndex:0]);
        
        
        // 很明显排序失败
        NSArray *sortChinese=[dataArray sortedArrayUsingSelector:@selector(compare:)];
        NSLog(@"first");
        for(NSString *string in sortChinese)
        {
            NSLog(@"%d",[string characterAtIndex:0]);
            NSLog(@"%@ %c",string,pinyinFirstLetter([string characterAtIndex:0]));
        }
    }
    return 0;
}
